<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>编辑套餐 - 管理后台</title>
    <link rel="stylesheet" href="/static/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/css/public.css?s=0.01" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form " action="" method="post">
    <input name="user_id" value="{$info['user_id']}" type="hidden">
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">微信昵称：</label>
        <div class="layui-form-mid">{$info['nickname']}</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">头像：</label>
        <div class="layui-form-mid"><img src="{$info['avatar']}" style="height: 30px;"></div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">姓名：</label>
        <div class="layui-input-inline">
            <input name="name" value="{$info['name']}" class="layui-input" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">公司名称：</label>
        <div class="layui-input-inline">
            <input name="company" value="{$info['company']}" class="layui-input" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">性别：</label>
        <div class="layui-input-block">
            <input name="sex" value="0" type="radio" title="未知" {if condition="!$info['sex']"}checked{/if}>
            <input name="sex" value="1" type="radio" title="男" {if condition="$info['sex'] == 1"}checked{/if}>
            <input name="sex" value="2" type="radio" title="女" {if condition="$info['sex'] == 2"}checked{/if}>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">职务：</label>
        <div class="layui-input-inline">
            <input name="position" value="{$info['position']}" class="layui-input" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">联系电话：</label>
        <div class="layui-input-inline">
            <input name="phone" value="{$info['phone']}" class="layui-input" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">公司地址：</label>
        <div class="layui-input-inline">
            <input name="address" value="{$info['address']}" class="layui-input" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">业务员：</label>
        <div class="layui-input-inline">
            <select name="admin_id">
                <option value="">请选择</option>
                {volist name="admin" id="val"}
                <option value="{$val['admin_id']}" {if condition="$info['admin_id'] == $val['admin_id']"}selected{/if}>{$val['nickname']}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">&nbsp;</label>
        <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="demo1">提交保存</button>
    </div>
</form>
<script src="/static/layui.js"></script>
<script>
    layui.use(['element','jquery','upload','layer','form','layedit','laydate'], function(){
        var element = layui.element,
            layer = layui.layer,
            form = layui.form,
            $ = layui.$;
        form.on('submit(demo1)', function(data){
            var index = layer.load(1);
            $.post('{:url("user/editUser")}',data.field,function (data) {
                if(data.code == 0){
                    layer.close(index);
                    layer.msg(data.msg,{
                        time: 3000,
                        icon:1
                    }, function(){
                        parent.layer.closeAll("iframe");
                        parent.layui.tableIns.reload();
                    });
                }else{
                    layer.close(index);
                    layer.msg(data.msg,{icon:5,shift:6});
                }
            });
            return false;
        });
        $('.childrenBody').on('click', 'img', function () {
            var img = new Array;
            img.push({src: $(this).attr('src')});
            layer.photos({
                photos: {data: img},
                anim: 5
            });
        });
    });
</script>
</body>
</html>